import { fileURLToPath, URL } from 'node:url'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// import Pages from 'vite-plugin-pages';
// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    // Pages({
    //   // 可以在这里自定义选项
    //   dirs: "src/views", 
    // }),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
    // host: '0.0.0.0',
    port: 81,
    // proxy: {
    //   '/api': {
    //     target: 'http://localhost:9090',
    //     // secure: false, // 请求是否为https
    //     changeOrigin: true,
    //     rewrite: (path) => path.replace(/^\/api/, '') //api替换为'',
    //   },
    // },
  }
})
